package com.wxtwxt.ruralmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.wxtwxt.ruralmall.common.valid.AddGroup;
import com.wxtwxt.ruralmall.common.valid.ListValue;
import com.wxtwxt.ruralmall.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author Wxt
 * @email wxt23787@126.com
 * @date 2023-01-30 19:53:31
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@Null(message = "新增不需要携带Id", groups = AddGroup.class)
	@NotNull(message = "更新必须携带Id", groups = UpdateGroup.class)
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空", groups = AddGroup.class)
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "品牌logo不能为空", groups = AddGroup.class)
	@URL(message = "品牌logo必须是一个url地址", groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank(message = "品牌介绍不能为空", groups = AddGroup.class)
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空", groups = AddGroup.class)
	@ListValue(values = {0,1}, groups = {AddGroup.class, UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "首字母必须填写", groups = AddGroup.class)
	@Pattern(regexp = "^[a-zA-Z]$", message = "首字母必须在a-z或A-Z之间", groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为空", groups = AddGroup.class)
	@Min(value = 0, message = "排序必须是正整数", groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
